package com.hdsx.restful.base;

import java.io.IOException;
import java.io.Serializable;
import java.text.DecimalFormat;

import com.esri.arcgis.geometry.IGeometry;
import com.esri.arcgis.geometry.IPoint;
import com.esri.arcgis.interop.AutomationException;

public abstract class HDPoint implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String id;
	/**  X坐标.*/
	private double ptx;
	/**  Y坐标.*/
	private double pty;
	/**  空间对象.*/
	private transient IGeometry shape;
	/**  导入人.*/
	private String drr;
	/**  是否存在.*/
	private String exist;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	public String getDrr() {
		return drr;
	}
	public void setDrr(String drr) {
		this.drr = drr;
	}
	public String getExist() {
		return exist;
	}
	public void setExist(String exist) {
		this.exist = exist;
	}
	public double getPtx() {
		return ptx;
	}
	public void setPtx(double ptx) {
		this.ptx = ptx;
	}
	public double getPty() {
		return pty;
	}
	public void setPty(double pty) {
		this.pty = pty;
	}
	public IGeometry getShape() {
		return shape;
	}
	public void setShape(IGeometry shape) {
		if(shape!=null)
		{
			IPoint point=(IPoint)shape;
			DecimalFormat df = new DecimalFormat("########.00000000");
			try 
			{
				setPtx(new Double(df.format(point.getX())));
				setPty(new Double(df.format(point.getY())));
			} catch (AutomationException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
	}
	@Override
	public String toString() {
		return "HDPoint [id=" + id + ", ptx=" + ptx + ", pty=" + pty
				+ ", shape=" + shape + ", drr=" + drr + ", exist=" + exist
				+ "]";
	}
	
	
}
